/**
 * File: TestController.java
 * Type: TestController
 * Created on 18-Apr-2011 at 12:26:31 AM
 */
package org.rvk.awasar.web.controllers;

import org.rvk.awasar.web.models.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * A Test controller.
 * 
 * @author Ashish Kumar Sinha <aksinha.iit@gmail.com>
 * Version 1.0
 */
@Controller
@RequestMapping(value="/test")
public class TestController {
	
	@RequestMapping(value="{name}", method=RequestMethod.GET)
	public String test(@PathVariable String name, Model model) {
		User user = new User();
		if(name.isEmpty()){
			user.setName("Guest");
			user.setId(-1L);
		}else{
			user.setId(1L);
			user.setName(name);
		}
		model.addAttribute(new User());
		return "test/sayHello";
	}
}
